Migrating from Macromedia Flash MX to Flash MX 2004
Table of Contents
- Introduction
- ActionScript in Flash MX and Flash MX 2004
- Components in Flash MX and Flash MX 2004
- Video in Flash MX and Flash MX 2004
- Data Integration in Flash MX and Flash MX 2004
- Authoring Environment Changes in Flash MX 2004
- Screens in Flash MX Professional 2004
- Flash Player 7 Enhancements and Changes
Components in Flash MX and Flash MX 2004
Macromedia introduced components in Flash MX as a way to help developers build user interfaces quickly. Flash MX 2004 debuts a new component architecture, called the version 2 (or v2) component architecture, that offers many features not available in the Flash MX component architecture (now called the version 1, or v1, architecture).
In addition, Flash MX 2004 ships with several more components than were shipped with Flash MX.
Differences Between Components in Flash MX and Flash MX 2004
If you programmed with the user interface components provided with Flash MX, you'll notice some changes in the v2 components. I discuss some of those changes below. For a full list of changes in v2 components, see What's New in v2 Components in the Using Components Guide.
New Component APIs and Event Model: Components you worked with before in Flash MX (for example, CheckBox or Button) expose a different set of properties and methods than you're used to. Because they inherit from (extend) the base classes of the v2 architecture (such as UIObject and UIComponent), the v2 components inherit the properties and methods provided by those classes.
The event handling model used by v2 components is also different than that used by v1 components. In Flash MX, you specified a "change handler" for a given component and then assigned a function to that change handler identifier:
// v1 change handler function:
componentHandler = function () {
// handle event here
}
Under the v2 component architecture in Flash MX 2004, you handle component
events using event listeners, or component on() event
handlers. You can't use the same kind of change handler code (as shown
above) that you may have used when programming with Flash MX components.
Below is an example of using an event listener. It consists of two parts: a listener object that responds to an event and a component instance that registers the listener object to receive the event:
listenerObject.eventName = function(evtObj){
// your code here
};
componentInstance.addEventListener("eventName", listenerObject);
Event listeners provide a more flexible event handling model than change handlers in Flash MX. For example, a listener object can receive events from several components; likewise, a component can broadcast a single event to multiple listeners. For more information about handling component events, see About Component Events in the Using Components Guide.
More Components: Flash MX 2004 and Flash MX Professional 2004 include many new components and several new versions of components than were included in Flash MX.
Flash MX 2004 ships with 13 user interface components (compared to 7 in Flash MX). Flash MX Professional 2004 ships with the user interface components included with Flash MX 2004, in addition to several advanced user interface components, data components for working with external data sources, and media components for drag-and-drop video authoring.
Note that the TextArea component in Flash MX 2004 replaces the ScrollBar component in Flash MX; it also has a built-in scrolling feature.
Using Flash MX Components in MX 2004
Flash MX components are written in ActionScript 1.0, and Flash MX 2004 and Flash MX Professional 2004 components are written in ActionScript 2.0. Depending on what version of Flash Player you are publishing to and what version of ActionScript you use to create your content, components that you used in your Flash MX projects may or may not function as expected.
Table 2 summarizes the expected or potential results of using Flash MX components in Flash MX 2004, according to the Flash Player version you publish to and the ActionScript version you use. In general, we recommended that you not use the Flash MX components when publishing to Flash Player 7. Macromedia will soon be releasing a version of the Flash MX components that work in Flash MX 2004 and Flash Player 7. Availability of these components will be announced on macromedia.com as soon as they are ready.
| Table 2. Functionality of Flash MX UI Components Used in Flash MX 2004 | ||
|---|---|---|
| Publish Format | ActionScript Version | Result |
| Flash Player 7 | ActionScript 2.0 | Components not likely to function as expected |
| Flash Player 7 | ActionScript 1.0 | Components not likely to function as expected |
| Flash Player 6 | ActionScript 2.0 | Components possibly not to function as expected |
| Flash Player 6 | ActionScript 1.0 | Components to function as expected |
Compatibility of Flash MX 2004 Components with Earlier Flash Player Versions
All the components that ship with Flash MX 2004 work in Flash Player 6 or later. With a couple of exceptions, noted below, all components that ship with Flash MX Professional 2004 work in Flash Player 6 and later.
The following components (available in Flash Professional only) require Flash Player 7 or later:
- Media components (MediaController, MediaDisplay, MediaPlayback)
- DataSet component
You must use the ActionScript 2.0 compiler when publishing documents that use Flash MX 2004 components (see Publishing to ActionScript 2.0 and ActionScript 1.0 earlier in the article).
Combining Flash MX and Flash MX 2004 Components in a Single Project
You can combine Flash MX and Flash MX 2004 components in a single Flash document, as long as you observe the rules of compatibility with ActionScript and the Flash Player versions (as described in the previous section. However, many of the automated infrastructure features provided by Flash MX 2004, such as live preview, may not work under these circumstances.
DevNet Resource Kit Components in Flash MX 2004
The Flash components included in DevNet Resource Kit (DRK) Volume 1-4 were not designed to work with Flash MX 2004. If you install the components into Flash MX 2004, they may not function properly.
DRK Volume 5 includes updated versions of DRK Volumes 1-4 components that work in Flash MX 2004 and Flash Player 7. For more information, see DevNet Resource Kit Volume 5.
In addition, the functionality of many of the components from DRK Volumes 1-4 have been included in the components that ship with Flash MX 2004 and Flash MX Professional 2004. These new components include all the advanced capabilities of the v2 component architecture.
The component functionality included in Flash MX Professional 2004 includes the following:
- DevNet Resource Kit Volume 1: DataGrid, Media Components, Loading Box, Advanced Message Box
- DevNet Resource Kit Volume 2: Smart Combo Box, Advanced Calendar, Simple Menu
- DevNet Resource Kit Volume 3: Text Field